Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

localforage

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

localforage

Offline storage, improved.

  • 1.10.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is localforage?

The localForage npm package is a fast and simple storage library for JavaScript. It improves the offline experience of web apps by using asynchronous storage (IndexedDB or WebSQL) with a simple, localStorage-like API. localForage uses a driver system that supports IndexedDB, WebSQL, and localStorage.

What are localforage's main functionalities?

Storing Data

This feature allows you to store data in the browser's asynchronous storage. The code sample demonstrates setting and then getting an item.

localforage.setItem('key', 'value').then(function () { return localforage.getItem('key'); }).then(function (value) { console.log(value); }).catch(function (err) { console.error(err); });

Retrieving Data

This feature allows you to retrieve data from the browser's asynchronous storage. The code sample demonstrates getting an item.

localforage.getItem('key').then(function (value) { console.log(value); }).catch(function (err) { console.error(err); });

Removing Data

This feature allows you to remove data from the browser's asynchronous storage. The code sample demonstrates removing an item.

localforage.removeItem('key').then(function () { console.log('Key is removed'); }).catch(function (err) { console.error(err); });

Clearing Storage

This feature allows you to clear all data from the browser's asynchronous storage. The code sample demonstrates clearing the storage.

localforage.clear().then(function () { console.log('Storage is now empty'); }).catch(function (err) { console.error(err); });

Iterating Over Keys

This feature allows you to iterate over all key-value pairs in the browser's asynchronous storage. The code sample demonstrates iterating over keys.

localforage.iterate(function (value, key, iterationNumber) { console.log([key, value]); }).then(function () { console.log('Iteration has completed'); }).catch(function (err) { console.error(err); });

Other packages similar to localforage

Keywords

FAQs

Package last updated on 18 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc